//
//  MyMessageController.m
//  OnionHome
//
//  Created by fengjie on 2019/10/14.
//  Copyright © 2019 FengJie. All rights reserved.
//

#import "MyMessageController.h"
#import "WonThePraiseController.h"
#import "ToObtainCollectionVC.h"
#import "MyPrivateMessageListVC.h"
#import "SystemMessageController.h"

@interface MyMessageController ()
/**<#属性#>*/
@property (nonatomic,strong)UITableViewTool*listViewTool;
/**<#属性#>*/
@property (nonatomic,strong)NSMutableArray*dataArray;
@end

@implementation MyMessageController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.title = @"消息";
    [self createUI];
}
-(void)createUI{
    self.view.backgroundColor = UIColorFromRGB(0xF5F7F5);
    [self.listViewTool.listView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.top.right.bottom.mas_equalTo(0);
    }];
}
-(void)pushController:(NSIndexPath *)indexPath{
    if (indexPath.row == 0) {
        [self.navigationController pushViewController:[WonThePraiseController new] animated:YES];
    }else if (indexPath.row == 1){
        [self.navigationController pushViewController:[ToObtainCollectionVC new] animated:YES];
    }else if (indexPath.row == 2){
        [self.navigationController pushViewController:[MyPrivateMessageListVC new] animated:YES];
    }else if (indexPath.row == 3){
        [self.navigationController pushViewController:[SystemMessageController new] animated:YES];
    }
}
-(UITableViewTool*)listViewTool{
    if(!_listViewTool){
        kWeakSelf(weakSelf);
        _listViewTool=[[UITableViewTool alloc] initWithFrame:CGRectZero style:UITableViewStylePlain registerCellClassName:NSStringFromClass([UITableViewCell class]) identifier:NSStringFromClass([UITableViewCell class]) dataArray:self.dataArray delegate:self dataSourceBlock:^(id  _Nonnull TempCell, NSIndexPath * _Nonnull indexPath, id  _Nonnull TempData) {
            UITableViewCell * cell = (UITableViewCell *)TempCell;
            cell.selectionStyle = UITableViewCellSelectionStyleNone;

            cell.textLabel.text = (NSString *)TempData;
            cell.textLabel.font = PingFangSC_Medium(18);
            
        } selectCell:^(id  _Nonnull TempCell, NSIndexPath * _Nonnull indexPath, id  _Nonnull TempData) {
            [weakSelf pushController:indexPath];
        }];
        _listViewTool.listView.tableFooterView = UIView.new;
        _listViewTool.listView.backgroundColor = UIColorFromRGB(0xF5F7F5);
        _listViewTool.listView.rowHeight = 66;
    }
    return _listViewTool;
}

-(NSMutableArray *)dataArray{
    if (!_dataArray) {
        _dataArray =[[NSMutableArray alloc] initWithObjects:@"获得赞",@"获得收藏",@"我的私信",@"系统通知", nil];
    }
    return _dataArray;
}
@end
